<?php

namespace app\admin\model;

use think\Model;
use think\model\concern\SoftDelete;

class FileOss extends Model
{
    use SoftDelete;
    protected $name = 'car_file_oss';
    protected $autoWriteTimestamp = true;
    protected $dateFormat = 'Y/m/d H:i:s';
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';
    protected $deleteTime='delete_at';

    public function aboutPhotoUser()
    {
        return $this->hasOne('PohtoUser', 'avatar_id', 'id')->bind([
            'photo_id' => 'id',
        ]);
    }

    public function aboutPohtoInstitution() {
        return $this->hasOne('PohtoInstitution', 'cover_id', 'id')->bind([
            'institution_id' => 'id',
        ]);
    }

    public function aboutBanner()
    {
        return $this->hasOne('Banner', 'image_id', 'id')->bind([
            'image_id' => 'id',
        ]);
    }

    public function aboutComment()
    {
        return $this->hasOne('CommentBg', 'image_id', 'id')->bind([
            'comment_id' => 'id',
        ]);
    }

    public function aboutVersion()
    {
        return $this->hasOne('Version', 'fileId', 'id')->bind([
            'fileId_id' => 'id',
            'versionName'
        ]);
    }
}